<template>
	<div>
		<el-tabs v-model="activeName" @tab-click="handleClick">
			<el-tab-pane label="已出库" name="first">
				<el-row :gutter="24">
					<el-col :span="24">
						<el-row :gutter="24">
							<el-col :span="1" style="">
								<p class="queryLabel">出库类型:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" v-model="carSelect.outType" placeholder="请选择调拨类型" clearable>
									<el-option v-for="item in transferTypeCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="2" style="text-align: right;">
								<p class="queryLabel">出库日期:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStart" size="small" style="width:100%;" type="date" clearable placeholder="出库日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">至:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStarts" size="small" style="width:100%;" type="date" clearable placeholder="出库日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">VIN:</p>
							</el-col>
							<el-col :span="3">
								<el-input placeholder="请输入VIN" size="small" style="width: 90%; margin-left: 15px;" v-model="carSelect.vin">
								</el-input>
							</el-col>
							<el-col :span="5" style="text-align: right;">
								<el-button type="primary" size="small" @click="query">查询</el-button>
								<el-button type="primary" size="small" @click="backCar">确认回库</el-button>
								<el-button type="primary" size="small" v-on:click='showdialog'>打印</el-button>
							</el-col>
						</el-row>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" stripe border @selection-change="handleSelectionChanges" :row-class-name="tableRowClassName">
							<el-table-column type="selection" width="55" label="选择">
							</el-table-column>
							<el-table-column prop="outDate" label="出库时间" width="120">
							</el-table-column>
							<el-table-column prop="estimateBackDate" label="预计回库时间" width="120">
							</el-table-column>
							<el-table-column prop="vin" label="VIN" width="180">
							</el-table-column>
							<el-table-column prop="outStatus" label="出库状态" width="180" :formatter="invoiceTypeCov">
							</el-table-column>
							<el-table-column prop="carSeriesName" label="车系名称" width="150">
							</el-table-column>
							<el-table-column prop="modelName" label="车型名称" width="150">
							</el-table-column>
							<el-table-column prop="configureName" label="配置名称" width="150">
							</el-table-column>
							<el-table-column prop="appearanceName" label="外观颜色" width="150">
							</el-table-column>
							<el-table-column prop="interiorName" label="内饰名称" width="150">
							</el-table-column>
							<el-table-column prop="chooseCode" label="加装代码" width="100">
							</el-table-column>
							<el-table-column prop="chooseName" label="加装名称" width="150">
							</el-table-column>
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
			<el-tab-pane label="待确认出库" name="second">
				<el-row :gutter="24">
					<el-col :span="24">
						<el-row :gutter="24">
							<el-col :span="2" style="">
								<p class="queryLabel">出库类型:</p>
							</el-col>
							<el-col :span="3">
								<el-select size="small" v-model="carSelect.outType" placeholder="请选择调拨类型" clearable>
									<el-option v-for="item in transferTypeCombo" :label="item.label" :value="item.value"></el-option>
								</el-select>
							</el-col>
							<el-col :span="2" style="text-align: right;">
								<p class="queryLabel">出库日期:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStart" size="small" style="width:100%;" type="date" clearable placeholder="出库日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">至:</p>
							</el-col>
							<el-col :span="3">
								<el-date-picker v-model="data.firstStarts" size="small" style="width:100%;" type="date" clearable placeholder="出库日期">
								</el-date-picker>
							</el-col>
							<el-col :span="1" style="">
								<p class="queryLabel">VIN:</p>
							</el-col>
							<el-col :span="3">
								<el-input placeholder="请输入VIN" size="small" style="width: 90%; margin-left: 15px;" v-model="carSelect.vin">
								</el-input>
							</el-col>
							<el-col :span="5" style="text-align: right;">
								<el-button type="primary" size="small" @click="query">查询</el-button>
								<el-button type="primary" size="small" @click="saveCar">确认出库</el-button>
								<el-button type="primary" size="small" @click="clean">清空查询条件</el-button>
							</el-col>
						</el-row>
					</el-col>
				</el-row>
				<el-row>
					<el-col :span="24">
						<el-table :data="tableData.dataList" stripe border @selection-change="handleSelectionChange">
							<el-table-column type="selection" width="55" label="选择">
							</el-table-column>
							<el-table-column prop="vin" label="VIN" width="180">
							</el-table-column>
							<el-table-column prop="outType" label="出库类型" width="180" :formatter="invoiceTypeCov">
							</el-table-column>
							<el-table-column prop="outStatus" label="出库状态" width="180" :formatter="invoiceStartCov">
							</el-table-column>
							<el-table-column prop="aimWarehouse" label="来源库" width="150" :formatter="aimWarehouseCov">
							</el-table-column>
							<el-table-column prop="allocationDate" label="调拨时间" width="150">
							</el-table-column>
							<el-table-column prop="allocationReason" label="调拨原因" width="150">
							</el-table-column>
							<el-table-column prop="estimateBackDate" label="预计回库时间" width="150">
							</el-table-column>
							<el-table-column prop="carSeriesName" label="车系名称" width="100">
							</el-table-column>
							<el-table-column prop="modelName" label="车型名称" width="150">
							</el-table-column>
							<el-table-column prop="configureName" label="配置名称" width="150">
							</el-table-column>
							<el-table-column prop="appearanceName" label="外观颜色" width="150">
							</el-table-column>
							<el-table-column prop="interiorName" label="内饰名称" width="150">
							</el-table-column>
							<el-table-column prop="chooseCode" label="加装代码" width="100">
							</el-table-column>
							<el-table-column prop="chooseName" label="加装名称" width="150">
							</el-table-column>

							<!--aimWarehouse调拨的,warehouseName是销售的-->
						</el-table>
						<el-pagination small @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="CurentPage" :page-sizes="page.pageSizes" :page-size="page.pageSize" layout=" total,prev, pager, next" :total="tableData.total">
						</el-pagination>
					</el-col>
				</el-row>
			</el-tab-pane>
		</el-tabs>
		<carserice :show="showStart" v-if="showStart" v-on:close="showStart=false" v-on:insert="insert"></carserice>
		<el-dialog tittl="打印" v-model="dayinFormShow" id="dvData" size="large">
			<div id="printHtml" style=" width: 100%;">
				<font face="宋体">
					<el-row>
						<div id="" style="margin-left: 35%; width: 65%;">
							<font face="宋体">
								<div style="border-collapse:collapse;font-size: 30px;margin:0 auto;color:#000000">
									车辆出库单
									<div style="border-collapse:collapse;font-size: 20px;margin:0 auto;color:#000000;margin-left: 25%;">1231321</div>
								</div>
							</font>
						</div>

					</el-row>
					<div>
						<table>
							<tr>
								<td width="1%">
									○请在此打孔装订○
								</td>
								<td width="97%">
									<table width="80%" border="1px solid #000000" cellspacing="0px" cellpadding="10px" bgcolor="#FFFFFF" style="border-collapse:collapse;font-size: 10px;margin:0 auto;color:#1F2D3D">
										<tr>
											<td width="20%" colspan="3"><b>车型:</b></td>
											<td width="15%" colspan="2"><b>颜色:</b></td>
											<td width="35%" colspan="1"><b>车架号码(后八位):</b></td>
											<td width="30%" colspan="1"><b>发票号</b></td>
										</tr>
										<tr>
											<td rowspan="6" width="10%" colspan="1"><b>销售部分填写</b></td>
											<td colspan="6">出库原因:</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□销售</b></div>
												<div style=" float:left; width: 170px;"><b>客户名字:</b></div>
												<div style=" float:left; width: 170px;"><b>地址:</b></div>
												<div style=" float:left; width: 170px;"><b>电话:</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□车展</b></div>
												<div style=" float:left; width: 100px;"><b>车展名称:</b></div>
												<div style=" float:left; width: 100px;"><b>地点:</b></div>
												<div style=" float:left; width: 100px;"><b>起止时间:</b></div><b>授权□未授权□</b></td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□二级</b></div>
												<div style=" float:left; width: 100px;"><b>网络名称:</b></div>
												<div style=" float:left; width: 100px;"><b>移出点:</b></div>
												<div style=" float:left; width: 100px;"><b>移入点:</b></div><b>授权□未授权□</b></td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 50px;"><b>□移库</b></div>
												<div style=" float:left; width: 100px;"><b>原因:</b></div>
												<div style=" float:left; width: 100px;"><b>移出点:</b></div>
												<div style=" float:left; width: 100px;"><b>移入点:</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="6">
												<div style="float:left;width: 100px;"><b>销售经理签字:</b></div>
												<div style="float:left;width: 100px;"><b>地址</b></div>
												<div style="float:left;width: 100px;"><b>电话</b></div>
											</td>
										</tr>
										<tr>
											<td rowspan="2" colspan="1">财务部门填写</td>
											<td colspan="6">如是销售，请填写：<br>
												<div style="float:left;width: 100px;"><b>客户类型:□个人</b></div>
												<div style="float:left;width: 100px;"><b>□单位</b></div>
												<div style="float:left;width: 100px;"><b>□其他(</b></div>
												<div style="float:left;width: 100px;"><b>)</b></div><br>
												<div style="float:left;width: 400px;"><b>付款方式: □现金□支票□电汇□GMACSAIC零售汇款□银行按揭□其他</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 150px;"><b>销售经理签字:</b></div>
												<div style="float:left;width: 100px;"><b>地址</b></div>
												<div style="float:left;width: 70px;"><b>日期:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 120px;"><b>库管签字:</b></div>
												<div style="float:left;width:200px;"><b>日期:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7">
												<div style="float:left;width: 300px;"><b>提车人:</b></div>
												<div style="float:left;width: 50px;"><b>年</b></div>
												<div style="float:left;width: 50px;"><b>月</b></div>
												<div style="float:left;width: 50px;"><b>日</b></div>
											</td>
										</tr>
										<tr>
											<td colspan="7"><b>备注：</b></td>
										</tr>
									</table>

								</td>
								<td valign="middle">
									<div style="font-size:12px!important;height: 300px; width: 12px;">
										请按照背面注意事项认真填写，涂改或复印无效
									</div>
								</td>
							</tr>
						</table>
					</div>
					<el-row>
						<div id="" style=" float: left;padding: 10px;">
							注意事项:<br> 1:出库单一式两联,销售部门掌握车辆出库单本票，签发出库单
							<br> 2:出库单必须保持序号连续，不能跳号，涂改，序号的缺失视作违规
							<br> 3:出库单涂改则注明“作废”，并保留“作废件”，并且在下一张顺次序号的出库单上重新填写
							<br> 4:每月下班后，库管将出库单原件（包括作废件）全部按编号次序归档
							<br>
						</div>
					</el-row>
				</font>
			</div>
			<!--底部的注意 结束-->
			<el-row style="margin-left:5px">
				<el-col>
					<el-button type="primary" @click="saveDayin">点击打印</el-button>
				</el-col>
			</el-row>
		</el-dialog>

		<el-dialog title="确认回库" v-model="comFormShow" size="small">
			<el-row>
				<el-form :model="confirmBackData" label-width="100px" ref="addFormData" :rules="addRule">
					<el-col :span="11" style="margin-right:20px;">
						<el-form-item label="入库仓库" required prop="aimWhereHouse">
							<el-select size="small" v-model="confirmBackData.aimWhereHouse">
								<el-option v-for="item in warehouseCombo" :label="item.label" :value="item.value"></el-option>
							</el-select>
						</el-form-item>
					</el-col>
					<el-col :span="11">
						<el-form-item label="入库日期" prop="aimhouseDate" required>
							<el-date-picker :picker-options="pickerOptions0" v-model="confirmBackData.aimhouseDate" size="small" style="width:100%;" type="date" clearable placeholder="回库日期">
							</el-date-picker>
						</el-form-item>
					</el-col>
				</el-form>
			</el-row>
			<!--<el-col :span="6">
				<el-select size="small" v-model="confirmBackData.aimWhereHouse">
					<el-option v-for="item in warehouseCombo" :label="item.label" :value="item.value"></el-option>
				</el-select>
			</el-col>
			<el-col :span="6">
				<el-date-picker :picker-options="pickerOptions0" v-model="confirmBackData.aimhouseDate" size="small" style="width:100%;" type="date" clearable placeholder="回库日期">
				</el-date-picker>
			</el-col>
			<el-col :span="4" style="padding-right: 0px;text-align: right">
				<el-button type="primary" v-on:click='confirmBackButton'>确认</el-button>
			</el-col>-->
			<div slot="footer" class="dialog-footer">
				<el-button @click="comFormShow = false">取 消</el-button>
				<el-button type="primary" v-on:click='confirmBackButton'>提 交</el-button>
			</div>

		</el-dialog>

	</div>
</template>

<script>
	import moment from 'moment'
	import carserice from '../../insPlugins/carSeries.vue'
	export default {
		data: function() {
			return {
				pickerOptions0: {
					disabledDate(time) {
						return time.getTime() > Date.now();
					}
				},
				//打印窗口
				dayinFormShow: false,
				//确认回库窗口
				comFormShow: false,
				activeName: 'first',
				//待出库车辆列表
				tableDataCar: {
					total: 0,
					dataList: []
				},
				//车辆查询条件
				conditionCar: {
					type: "1" //出库类型
				},
				//暂估金额显示框
				editFormShow: false,
				//修改金额的form
				comFormDataPrice: {
					id: "",
					price: ""
				},
				//车系选择窗
				showStart: false,
				//查询条件-车型
				carModel: "",
				//日期
				data: {
					firstStart: "",
					firstStarts: ""
				},
				//调拨类型
				transferTypeCombo: [{
					label: '销售出库',
					value: '1'
				}, {
					label: '调拨出库',
					value: '2'
				}],
				//页码数
				CurentPage: 1,
				//每页的数量
				page: this.page,
				tableData: {
					total: 0,
					dataList: []
				},
				carStart: "",
				outTypeComboData: [{
					value: '1',
					label: '销售出库'
				}, {
					value: '0',
					label: '车辆调拨'
				}],
				//选中的列
				multipleSelection: [],
				//选中的列
				multipleSelections: [],
				carModelCode: "",
				//查询条件
				carSelect: {
					//状态 
					outStatus: "1",
					//调拨类型 
					outType: "",
					//出库时间
					outDateStart: "",
					//出库时间
					outDateStop: "",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					vin: "",
				},

				//查询条件清空
				carSelectS: {
					//车辆状态 
					status: "",
					//单位 
					companyId: [],
					//初次入库起
					purchaseStartDate: "",
					//初次入库止 
					purchaseStopDate: "",
					//车系代码
					carSeriesCode: "",
					//车型代码 
					carModelCode: "",
					//配置代码
					carConfigureCode: "",
					//仓库
					warehouse: "",
					vin: "",
				},
				//车型名称
				carModelCode: "",
				//配置的下拉
				configCombo: [],
				//车型的下拉
				modelCombo: [],
				//配置的下拉
				statusCombo: [{
					value: '0',
					label: '未确认出库'
				}, {
					value: '1',
					label: '已确认出库'
				}],
				//车型名称
				carModelCodes: "",
				//配置的下拉
				configCombos: [],
				//车型的下拉
				modelCombos: [],
				//确认回库数据集
				confirmBackData: {
					id: [],
					aimWhereHouse: "",
					aimhouseDate: "",
				},
				//仓库下拉
				warehouseCombo: [],
				//warehouseComboCow: {},
				//仓库转换
				levelConvertData: {},
				addRule: {
					aimWhereHouse: [{
						required: true,
						message: '请选择入库仓库',
						trigger: 'blur'
					}],
					aimhouseDate: [{
						required: true,
						message: '请选择入库时间',
						trigger: 'blur',
						type: 'date'
					}]
				},
			}
		},
		methods: {
			saveDayin: function() {
				debugger;
				var outstr = document.getElementById("printHtml").innerHTML;
				var printWindow = window.open();
				printWindow.document.body.innerHTML = outstr;
				printWindow.print();
				printWindow.close();
				this.$data.dayinFormShow = false;
			},
			showdialog: function() {

				this.$data.dayinFormShow = true;

			},

			//tabs页面切换
			handleClick(tab, event) {
				debugger;
				if(tab.name == "first") {
					this.$data.carSelect.outStatus = "1" //已出库
				} else {
					this.$data.carSelect.outStatus = "0" //未出库
				}
				this.$data.CurentPage = 1
				this.query();
				console.log(tab, event);
			},
			//出库状态转换
			invoiceStartCov: function(row, column) {
				var temp = '';
				switch(row.outStatus) {
					case '0':
						temp = "未确认出库";
						break;
					case '1':
						temp = '已确认出库';
						break;
					default:
						''
						break
				};
				return temp;
			},
			//出库类型转换
			invoiceTypeCov: function(row, column) {
				var temp = '';
				switch(row.outType) {
					case '1':
						temp = "销售出库";
						break;
					case '2':
						temp = '调拨出库';
						break;
					default:
						''
						break
				};
				return temp;
			},
			//清空查询条件
			clean: function() {
				this.$data.carSelect = Object.assign(this.$data.carSelect, this.$data.carSelectS);
				this.$data.carModelCode = "";
			},
			//车型改变的回调
			changeModel: function(val) {
				if(val != "") {
					this.comboConfigure(val);
				}
				debugger;
			},
			//车型改变的回调
			changeModels: function(val) {
				if(val != "") {
					this.comboConfigures(val);
				}
				debugger;
			},
			//选择车型后的回调
			comboConfigure: function(val) {
				this.$http.get(this.API_ROOT + '/base/carConfigure/combo', {
					params: {
						modelId: val
					}
				}).then((response) => {
					debugger;
					this.$data.configCombo = response.data;
					this.$data.carSelect.carConfigureCode = "";
					//this.$message(response.data);
				}, (response) => {});
			},
			//确认出库
			saveCar: function() {
				if(this.$data.multipleSelection.length >= 1) {
					var vinList = [];
					for(var i = 0; i < this.$data.multipleSelection.length; i++) {
						var vins = {}
						vins.vin = this.$data.multipleSelection[i].vin;
						vins.type = this.$data.multipleSelection[i].outType;
						vinList.push(vins);
					}
					this.$http.post(this.API_ROOT + '/scm/out/update', vinList, {
						params: {
							//vin: this.$data.multipleSelection[0].vin,
							//type: this.$data.multipleSelection[0].outType,
						}
					}).then(resp => {
						debugger;
						this.$message(resp.data.msg);
						this.$data.editFormShow = false;
						this.query();
					}, resp => {});
				} else {
					this.$message.error("请至少选择一条数据！");
				}
			},
			//确认回库提交
			confirmBackButton: function() {
				debugger;
				this.$refs.addFormData.validate(function(valid, $event) {
					if(valid) {
						this.$data.confirmBackData.aimhouseDate = this.momentFu(this.$data.confirmBackData.aimhouseDate);
						debugger;
						this.$http.post(this.API_ROOT + '/scm/enterWarehouse/confirmBack', this.$data.confirmBackData, {
							params: {}
						}).then(resp => {
							if(resp.data.success) {
								this.$data.comFormShow = false;
								this.$message("回库完成");
								this.query();
							} else {
								this.$message.error(resp.data.msg);
							}
						}, resp => {});
					} else {
						return false
					}
				}.bind(this))
			},
			//确认回库
			backCar: function() {
				//this.$data.confirmBackData.vin = this.$data.multipleSelections[0].vin;
				if(this.$data.multipleSelections.length >= 1) {
					this.$data.confirmBackData.id = [];
					//if(true) {
					for(var i = 0; i < this.$data.multipleSelections.length; i++) {
						this.$data.confirmBackData.id[i] = this.$data.multipleSelections[i].carId
					}
					this.house();
					this.$data.comFormShow = true;
				} else {
					this.$message.error("请选择至少一条数据！");
				}

			},
			// 获取仓库函数
			house: function() {
				//获取仓库的下拉
				this.$http.get(this.API_ROOT + '/scm/warehouse/combo', {
					params: {}
				}).then((response) => {
					this.$data.warehouseCombo = response.data;
					this.$data.warehouseComboCow = response.data;
					debugger;
				}, (response) => {});
			},
			//查询选择的车辆
			carQuery: function() {

				this.$http.get(this.API_ROOT + '/scm/out/notOut', {
					params: {
						type: this.$data.conditionCar.type
					}
				}).then(resp => {
					debugger;
					this.$data.tableDataCar.dataList = resp.data;
				}, resp => {});
				debugger;
			},
			//车系选择的回调
			insert: function(val, lable) {
				debugger;
				if(this.$data.addNoStoreFormShow == true) {
					this.$data.addNoStoreFormData.carSeriesCode = val;
					this.$data.carModelCodes = lable;
					this.$http.get(this.API_ROOT + '/base/carModel/combo', {
						params: {
							seriesId: val
						}
					}).then((response) => {
						debugger;
						this.$data.modelCombos = response.data;
						this.$data.addNoStoreFormData.carModelCode = "";
						this.$data.addNoStoreFormData.carConfigureCode = "";
						//this.$message(response.data);
					}, (response) => {});
				} else {
					this.$data.carSelect.carSeriesCode = val;
					this.$data.carModelCode = lable;
					this.$http.get(this.API_ROOT + '/base/carModel/combo', {
						params: {
							seriesId: val
						}
					}).then((response) => {
						debugger;
						this.$data.modelCombo = response.data;
						this.$data.carSelect.carModelCode = "";
						this.$data.carSelect.carConfigureCode = "";
						//this.$message(response.data);
					}, (response) => {});
				}
			},
			//根据金额提示表格颜色
			tableRowClassName(row, index) {
				debugger;
				if(row.estimateBackDate > 0) {
					return ''
				} else {
					if(row.estimateBackDate < this.moment(new Date().toISOString()).format("YYYY-MM-DD")) {
						return 'day-row';
					}
					return '';
				}

			},
			//打开车型车系选择
			handleIconClick: function() {
				this.$data.showStart = true;
			},
			//复选框回调函数
			handleSelectionChange: function(val) {
				debugger;
				this.$data.multipleSelection = val;
			}, //复选框回调函数
			handleSelectionChanges: function(val) {
				debugger;
				this.$data.multipleSelections = val;
			},
			//列表，分页大小切换
			handleSizeChange: function() {},
			//列表,当前页切换
			handleCurrentChange: function(currentPage) {
				this.$data.CurentPage = currentPage;
				this.query();
			},
			//接收仓库代码与名称转换
			aimWarehouseCov: function(row) {
				return this.$data.levelConvertData[row.aimWarehouse];
			},
			//仓库转换转换
			warehouseCovert: function() {
				this.$http.get(this.API_ROOT + '/scm/warehouse/convert', {
					params: {}
				}).then((response) => {
					this.$data.levelConvertData = response.data;
				}, (response) => {});
			},
			//查询
			query: function() {
				//debugger;
				this.$data.carSelect.outDateStart = this.momentFu(this.$data.data.firstStart);
				this.$data.carSelect.outDateStop = this.momentFu(this.$data.data.firstStarts);
				this.$http.post(this.API_ROOT + '/scm/out/requisitionPage', this.$data.carSelect, {
					params: {
						//root: window.localStorage.getItem("companyId"),
						//status: this.$data.queryStatus,
						start: this.$data.CurentPage,
						limit: this.$data.page.pageSize
					}
				}).then(resp => {
					if(resp.data.success) {
						resp.data.total = parseInt(resp.data.total);
						this.$data.tableData = resp.data;

					} else {
						this.$message.error(resp.data.msg);
					}
				}, resp => {})
				debugger;
			},
			//查询已出库列表
			//			query: function() {
			//				//开始时间
			//				this.$data.carSelect.createStartDate = this.momentFu(this.$data.data.firstStart);
			//				this.$data.carSelect.createStopDate = this.momentFu(this.$data.data.firstStarts);
			//				this.$http.post(this.API_ROOT + '/scm/out/page', this.$data.carSelect, {
			//					params: {
			//						start: this.$data.CurentPage,
			//						limit: this.$data.page.pageSize
			//					}
			//				}).then(resp => {
			//					if(resp.data.success) {
			//						resp.data.total = parseInt(resp.data.total);
			//						// es5写法
			//						this.$data.tableData = resp.data;
			//						//this.baseQuery(this.$data.curTreeDeptId);
			//						//this.$data.exFormShow = false;
			//					} else {
			//						//debugger;
			//						this.$message.error(resp.data.msg);
			//					}
			//				}, resp => {});
			//			},
			//时间判断为空的封装
			momentFu: function(dt) {
				if(dt == '' || dt == null || dt == undefined) {
					return "";
				} else {
					return this.moment(dt).format("YYYY-MM-DD");
				}
			},

		},
		components: {
			carserice
		},
		created: function() {
			this.query();
			//this.house();
			this.warehouseCovert();
		}
	}
</script>

<style>
	.el-table .day-row {
		background: #FF4949;
	}
</style>